package com.platform.module.common.redis;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.RedisConnectionFailureException;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Order(6)
public class CacheClientAspect {
    private static final Logger log = LoggerFactory.getLogger(CacheClientAspect.class);

    @Around("execution(* com.platform.module.common.redis.CacheClient.*(..)) )")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        try {
            return point.proceed();
        } catch (RedisConnectionFailureException e) {
            log.info("redis服务器连接异常", e);
            return null;
        }
    }
}
